package gbase

// 对FilePath的升级
type File struct {

	//根目录,相对目录或绝对目录 eg /home or ../static or ./static
	Root string

	//短路径，与根目录拼接形成全路径
	Path string
}

func (this *File) WithRoot(root string) *File {
	this.Root = root
	return this
}

func (this *File) WithPath(path string) *File {
	this.Path = path
	return this
}

func (this *File) ToFullFilePath() Filepath {
	return Filepath(this.Root + this.Path)
}

func NewFile(path ...string) (obj *File) {
	obj = new(File)
	if len(path) > 0 {
		obj.Path = path[0]
	}
	return
}
